from utils.m4_summary import M4Summary

def summary(file_path):
    m4_summary = M4Summary(file_path, './dataset/m4')
    smape_results, owa_results, mape, mase = m4_summary.evaluate()
    print('smape:', smape_results)
    print('mape:', mape)
    print('mase:', mase)
    print('owa:', owa_results)
    with open(file_path + 'metrics.txt', 'w') as f:
        f.write('smape:'+ str(smape_results) + '\n')
        f.write('mape:'+ str(mape) + '\n')
        f.write('mase:'+ str(mase) + '\n')
        f.write('owa:'+ str(owa_results))

for model in ['Autoformer','DLinear','iTransformer','Nonstationary_Transformer','TimeMixer','TimesNet', 'timer1', 'deepseek']:
#for model in ['timer1']:
    file_path = './m4_results/' + model + '/'
    summary(file_path)
